#ifndef ZIYA_LINUX_MEMORY_E820_H
#define ZIYA_LINUX_MEMORY_E820_H
#include "types.h"
#include "numa.h"
#include "bootparam.h"

enum e820_type
{
    E820_TYPE_RAM = 1,
    E820_TYPE_RESERVED,
    E820_TYPE_ACPI,
    E820_TYPE_NVS,
    E820_TYPE_UNUSABLE,
    E820_TYPE_PMEM = 7,
    E820_TYPE_PRAM = 12,
    E820_TYPE_RESERVED_KERN = 128,
};

struct e820_entry 
{
    union 
    {
        u64 addr;
        struct 
        {
            u32 low;
            u32 high;
        };
    } addr;
    union 
    {
        u64 size;
        struct
        {
            u32 low;
            u32 high;
        };
    } size;
    
    enum e820_type type;
} __attribute__((packed));

#define E820_MAX_ENTRIES (E820_MAX_ENTRIES_ZEROPAGE + 3 * MAX_NUMNODES)

struct e820_table
{
    u32 nr_entries;
    struct e820_entry entries[E820_MAX_ENTRIES];
};

void e820_memory_setup(void);

void e820_print_table(void);

void e820_memblock_setup(void);
#endif